package rpd.mapper;

import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import rpd.model.TbHr;
import rpd.model.TbHrExample;
import rpd.model.TbHrKey;

public interface TbHrMapper {
    long countByExample(TbHrExample example);

    int deleteByExample(TbHrExample example);

    @Delete({
        "delete from tb_hr",
        "where id = #{id,jdbcType=CHAR}"
    })
    int deleteByPrimaryKey(TbHrKey key);

    @Insert({
        "insert into tb_hr (id, user_id, company_id, ",
        "start_time, end_time, is_finish)",
        "values (#{id,jdbcType=CHAR}, #{userId,jdbcType=CHAR}, #{companyId,jdbcType=CHAR}, ",
        "#{startTime,jdbcType=DATE}, #{endTime,jdbcType=DATE}, #{isFinish,jdbcType=INTEGER})"
    })
    int insert(TbHr record);

    int insertSelective(TbHr record);

    List<TbHr> selectByExample(TbHrExample example);

    @Select({
        "select",
        "id, user_id, company_id, start_time, end_time, is_finish",
        "from tb_hr",
        "where id = #{id,jdbcType=CHAR}"
    })
    @ResultMap("rpd.mapper.TbHrMapper.BaseResultMap")
    TbHr selectByPrimaryKey(TbHrKey key);

    int updateByExampleSelective(@Param("record") TbHr record, @Param("example") TbHrExample example);

    int updateByExample(@Param("record") TbHr record, @Param("example") TbHrExample example);

    int updateByPrimaryKeySelective(TbHr record);

    @Update({
        "update tb_hr",
        "set user_id = #{userId,jdbcType=CHAR},",
          "company_id = #{companyId,jdbcType=CHAR},",
          "start_time = #{startTime,jdbcType=DATE},",
          "end_time = #{endTime,jdbcType=DATE},",
          "is_finish = #{isFinish,jdbcType=INTEGER}",
        "where id = #{id,jdbcType=CHAR}"
    })
    int updateByPrimaryKey(TbHr record);
}